package com.huawei.appmarket.service.store.awk.card;

import android.content.Context;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import com.huawei.appgallery.foundation.card.base.bean.BaseDistCardBean;
import com.huawei.appgallery.foundation.ui.framework.cardkit.bean.CardBean;
import com.huawei.appmarket.framework.widget.RoundCornerLayout;
import com.huawei.appmarket.service.store.awk.bean.SingleAppListCardBean;
import com.huawei.appmarket.support.video.VideoPlayer;
import java.util.ArrayList;
import o.chy;
import o.clk;
import o.Logger;
import o.dof;
import o.ContentManager;
import o.eqx;
import o.evp;
import o.evp.b;
import o.evt;
import o.evx;
import o.ewm.h;
import o.ewm.j;

public class HorizontalAppBigItemCard extends HorizontalBigImgItemCard implements clk {
    public /* synthetic */ CardBean ˌ() {
        return ʻ();
    }

    public HorizontalAppBigItemCard(Context context) {
        super(context);
    }

    public SingleAppListCardBean ʻ() {
        if (this.ˊᐝ instanceof SingleAppListCardBean) {
            return (SingleAppListCardBean) this.ˊᐝ;
        }
        return null;
    }

    public void ˏ(CardBean cardBean) {
        if (TextUtils.isEmpty(cardBean.ॱˌ())) {
            cardBean.ˋᐝ("");
        }
        super.ˏ(cardBean);
        if (cardBean instanceof SingleAppListCardBean) {
            SingleAppListCardBean singleAppListCardBean = (SingleAppListCardBean) cardBean;
            if (singleAppListCardBean.ٴ() != 0) {
                this.ʻ.setVisibility(0);
                eqx.ˎ(this.ʻ, singleAppListCardBean.ՙ());
                this.ˉ.setText(singleAppListCardBean.ߴ());
            } else {
                this.ʻ.setVisibility(8);
            }
            if (Logger.ˎ()) {
                Logger.ˏ("HorizontalBigImgItemCard", "bean.getVideoUrl_()=" + singleAppListCardBean.ʻˋ());
            }
            int i = j.ʿˈ;
            int i2 = j.ʿʿ;
            String str = (String) this.ʽ.getTag(i);
            String str2 = (String) this.ʽ.getTag(i2);
            if (!dof.ˋ(str) && str.equals(singleAppListCardBean.ʻˋ())) {
                return;
            }
            if (dof.ˋ(str2) || !str2.equals(singleAppListCardBean.ʻᐝ())) {
                str = singleAppListCardBean.ʻᐝ();
                this.ʽ.setTag(i, singleAppListCardBean.ʻˋ());
                this.ʽ.setTag(i2, str);
                ˋ(this.ʼ, singleAppListCardBean.ˋʻ());
                if (TextUtils.isEmpty(singleAppListCardBean.ʻˋ())) {
                    this.ˏॱ.removeView(this.ॱˊ);
                    this.ॱˊ = null;
                    this.ॱॱ = null;
                    ˏ(singleAppListCardBean);
                    return;
                }
                this.ˏॱ.removeView(this.ˊॱ);
                this.ˊॱ = null;
                ॱ(singleAppListCardBean);
            }
        }
    }

    public void ॱ(BaseDistCardBean baseDistCardBean) {
        if (this.ˊ == null) {
            return;
        }
        if (baseDistCardBean.ʾ() != null) {
            this.ˊ.setVisibility(0);
            this.ˊ.setParam(baseDistCardBean);
            ॱ(this.ˊ.ॱ());
            return;
        }
        this.ˊ.setVisibility(8);
    }

    private void ॱ(SingleAppListCardBean singleAppListCardBean) {
        if (this.ॱˊ == null || this.ॱॱ == null) {
            this.ॱˊ = (RoundCornerLayout) LayoutInflater.from(this.ʼॱ).inflate(ao_(), this.ˏॱ, false);
            this.ॱॱ = (VideoPlayer) this.ॱˊ.findViewById(j.ॱꓸ);
            this.ˏॱ.addView(this.ॱˊ);
        }
        if (this.ॱॱ != null) {
            evp ॱ;
            b ᐝ = new b().ˎ(singleAppListCardBean.ʽᐝ()).ˊ(singleAppListCardBean.ʻᐝ()).ˋ(singleAppListCardBean.ʻˋ()).ˏ(singleAppListCardBean.ͺˏ()).ॱ(singleAppListCardBean.u_()).ʼ(singleAppListCardBean.ᐝʻ()).ʻ(evt.ˏ(singleAppListCardBean.sp_)).ॱॱ(singleAppListCardBean.ॱـ()).ᐝ(singleAppListCardBean.ॱﾟ());
            if (TextUtils.isEmpty(ʻ().ʻˊ()) || !ʻ().ʻˊ().contentEquals(SingleAppListCardBean.SINGLE_APPLIST_SBUSTANCE_TYPE)) {
                ॱ = ᐝ.ॱ();
            } else {
                ॱ = ᐝ.ˋ(true).ॱ();
            }
            this.ॱॱ.setVideoBaseInfo(ॱ);
            eqx.ˋ(this.ˋ, this.ᐝ, this.ॱॱ.ॱॱ(), singleAppListCardBean.ʻᐝ());
            this.ॱॱ.ॱॱ().setContentDescription(singleAppListCardBean.v_());
            this.ॱॱ.ॱॱ().setOnClickListener(this.ͺ);
        }
    }

    private void ˏ(SingleAppListCardBean singleAppListCardBean) {
        Context ˋ = ContentManager.getInstant().getContext();
        if (this.ˊॱ == null) {
            this.ˊॱ = (ImageView) LayoutInflater.from(ˋ).inflate(h.ॱﾞ, this.ˏॱ, false);
            this.ˏॱ.addView(this.ˊॱ);
        }
        if (this.ˊॱ != null) {
            eqx.ˋ(this.ˋ, this.ᐝ, this.ˊॱ, singleAppListCardBean.ʻᐝ());
            this.ˊॱ.setContentDescription(singleAppListCardBean.ʾॱ());
            this.ˊॱ.setOnClickListener(this.ͺ);
        }
    }

    public ArrayList<String> ॱ() {
        ArrayList<String> arrayList = new ArrayList();
        if (!(ʻ() == null || ʻ().ॱॱ() == null)) {
            arrayList.add(ˊ(ʻ().ॱॱ()));
            if (!TextUtils.isEmpty(ʻ().ʼˋ())) {
                arrayList.add(ˊ(ʻ().ʼˋ()));
            }
        }
        return arrayList;
    }

    private String ˊ(String str) {
        StringBuilder stringBuilder = new StringBuilder(256);
        stringBuilder.append(str);
        stringBuilder.append("#$#");
        if (ʻ().u_() != null) {
            stringBuilder.append(ʻ().u_());
        }
        return stringBuilder.toString();
    }

    public void ॱ(final chy o_chy) {
        OnClickListener anonymousClass2 = new evx(this) {
            final /* synthetic */ HorizontalAppBigItemCard ˋ;

            public void ˋ(View view) {
                String ॱॱ = this.ˋ.ʻ().ॱॱ();
                this.ˋ.ʻ().ॱ(this.ˋ.ʻ().ʼˋ());
                o_chy.ˏ(0, this.ˋ);
                this.ˋ.ʻ().ॱ(ॱॱ);
            }
        };
        this.ʽ.setOnClickListener(anonymousClass2);
        ʼॱ().setOnClickListener(anonymousClass2);
        this.ͺ = new evx(this) {
            final /* synthetic */ HorizontalAppBigItemCard ॱ;

            public void ˋ(View view) {
                this.ॱ.ʻ().ॱ(this.ॱ.ʻ().ॱॱ());
                o_chy.ˏ(0, this.ॱ);
            }
        };
    }
}
